using System.Windows.Forms;
using Tiwo.Design.Renderers;
using Tiwo.Elements;

namespace Tiwo.Design.Controllers
{
    public class ChangePointTypeAction : ActionVerb
    {
        public InputFlowPoint Point { get; set; }
        public Environment Environment { get; private set; }

        public ChangePointTypeAction(InputFlowPoint point, Environment environment)
        {
            Environment = environment;
            Point = point;
            Title = "Change type";
        }

        public override void Run()
        {
            using (var dlg = new SelectTypeSource())
            {
                dlg.TypeSourceList = Environment.TypeSources;
                if (dlg.ShowDialog() != DialogResult.OK)
                    return;
                Point.TypeDefinition = dlg.TypeSource;
            }
        }
    }
}